const { Sequelize, Model, INTEGER } = require('sequelize')
const { db } = require('../core/sequelize')
class CategoryPexels extends Model {
    static async getPexelsList() {
        const pexelsList = await CategoryPexels.findAll()
        return { pexelsList }
    }
}
CategoryPexels.init(
    {
        id: {
            type: Sequelize.INTEGER,
            primaryKey: true, //设置主键
            autoIncrement: true,
        },
        // pexelsid: { type: INTEGER, },
        categoryid: { type: INTEGER, },

    },
    {
        // underscored: true,
        sequelize: db,
        modelName: 'pexelsCategory', timestamps: false
    }
)

CategoryPexels.associate = function () {
    // Pexels.belongsToMany(db.models.category, {
    //     through: db.models.pexelsCategory,
    //     foreignKey: 'categoryid',
    //     otherKey: 'pexelsid',
    // })
    // Category.belongsToMany(db.models.pexels, {
    //     through: db.models.pexelsCategory,
    //     foreignKey: 'pexelsid',
    //     otherKey: 'categoryid',
    // });

}
module.exports = { CategoryPexels }
